//
//  AppDelegate.m
//  OAProject
//
//  Created by yhj on 2017/2/20.
//  Copyright © 2017年 cdnunion. All rights reserved.
//

#import "AppDelegate.h"
#import "CYLTabBarControllerConfig.h"
#import "LoginViewController.h"
#import "AppDelegate+Push.h"

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window=[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];

    if ([[Util getUserDefaultObjectForKey:ISLogin] isEqualToString:@"YES"])
    {
        self.window.rootViewController=[[CYLTabBarControllerConfig new]tabBarController];
    }
    else
    {
        self.window.rootViewController=[LoginViewController new];
    }

    [self setNavigationBar];

    [self.window  makeKeyAndVisible];

    self.window.backgroundColor=WhiteColor;

   
    // 注册APNs 
    [self registerRemoteNotification];
    [self startGeTuiSdk];

    // 设置键盘
    [self setKeyboardManager];

    return YES;
}

// 设置键盘
-(void)setKeyboardManager
{
    IQKeyboardManager *manager=[IQKeyboardManager sharedManager];
    manager.enable=YES;
    manager.shouldResignOnTouchOutside=YES;
    manager.shouldToolbarUsesTextFieldTintColor=YES;
    manager.enableAutoToolbar=NO;
}

-(void)setNavigationBar
{
    [[UINavigationBar appearance]setBarTintColor:MainColor];
    [[UINavigationBar appearance]setTitleTextAttributes:@{NSForegroundColorAttributeName:WhiteColor,
                                                          NSFontAttributeName:Font_Number(20)}];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
}

@end
